<%@ page import="com.probiz.estore.webapp.util.RequestContext" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ taglib prefix="product" tagdir="/WEB-INF/tags/product"%>
<%@ taglib prefix="system" tagdir="/WEB-INF/tags/system"%>
<%@ taglib prefix="sales" tagdir="/WEB-INF/tags/sales"%>
<%
	request.setAttribute("isAnonymousUser",RequestContext.isAnonymousUser());
%>

<c:choose>
	<c:when test="${not empty favoriteList}">
		<ul class="content clearfix" id="favoriteListDiv">
			<c:forEach items="${favoriteList}" var="favorite" varStatus="status">
				<c:if test="${favorite.type == 1}">
				<li id="fav${favorite.favoriteId}" <c:if test="${(status.index+1)%5 == 0}">class="last"</c:if> >
					<product:productImage product="${favorite.product}" width="160" height="160" sizeType="s2" linkType="1"/>
					<h4><a href="<product:productUrl product="${favorite.product}"/>">${favorite.product.productName}</a></h4>
					<span class="do">
						<div class="s1">
							<a href="javascript:void(0)" 
								onclick="addToCart('${favorite.product.defaultProductSku.productSkuCode}', null, ${(not empty favorite.product.minOrderQuantity)?favorite.product.minOrderQuantity:1}, addToCartCallback);">
								<fmt:message key="shoppingcart.moveToCart"/>
							</a>
						</div>
						<div class="s2">
							<a href="javascript:void(0)"
								onclick="deleteFavorite(${favorite.favoriteId}, function(){$j('#fav${favorite.favoriteId}').remove();deleteFavoriteCallback();});">
								<fmt:message key="shoppingcart.delete"/>
							</a>
						</div>
					</span>
					<product:productPrice productSku="${favorite.product.defaultProductSku}" multiple="true" hasPriceName="true"/>
				</li>
				</c:if>
			</c:forEach>
		</ul>
	</c:when>
	<c:when test="${isAnonymousUser}">
		<div class="msg">
			<fmt:message key="shoppingcart.favorite.isAnonymousUser">
				<fmt:param>${ctxPath}/customer/register.html</fmt:param>
				<fmt:param>${ctxPath}/login.html</fmt:param>
			</fmt:message>
		</div>
	</c:when>
	<c:otherwise>
		<div class="msg">
			<fmt:message key="shoppingcart.favorite.noItems"/>
		</div>
	</c:otherwise>
</c:choose>
